package com.jy.admin.db.dao.impl;

import com.fqgj.common.api.Page;
import com.fqgj.common.base.AbstractBaseMapper;
import com.jy.admin.db.dao.CeAgentAccountDao;
import com.jy.admin.db.entity.CeAgentAccountEntity;
import com.jy.admin.enums.WhiteListBean;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * User: anonymous
 * Date: 2022-01-03
 * Time: 18:14:20.071
 */

@Repository
public class CeAgentAccountDaoImpl extends AbstractBaseMapper<CeAgentAccountEntity> implements CeAgentAccountDao {


    @Override
    public List<CeAgentAccountEntity> selectNoLoginList(String merchantCode) {
        Map<String, Object> params = new HashMap<>();
        params.put("merchantCode",merchantCode);
        return getSqlSession().selectList(this.getStatement("selectNoLoginList"), params);
    }

    @Override
    public List<CeAgentAccountEntity> queryAll() {
        Map<String, Object> params = new HashMap<>();
        return getSqlSession().selectList(this.getStatement("queryAll"), params);
    }

    @Override
    public CeAgentAccountEntity queryAccount(String account, String merchantCode) {
        Map<String, Object> params = new HashMap<>();
        params.put("account", account);
        params.put("merchantCode", merchantCode);
        return getSqlSession().selectOne(this.getStatement("queryAccount"), params);
    }

    @Override
    public CeAgentAccountEntity getByAgentCode(String agentCode) {
        Map<String, Object> params = new HashMap<>();
        params.put("agentCode", agentCode);
        return getSqlSession().selectOne(this.getStatement("getByAgentCode"), params);
    }

    @Override
    public List<CeAgentAccountEntity> getAccountsByStatus(Integer status) {
        Map<String, Object> params = new HashMap<>();
        params.put("status", status);
        return getSqlSession().selectList(this.getStatement("getAccountsByStatus"), params);
    }

    @Override
    public List<CeAgentAccountEntity> getAccountsMerchantCode(String merchantCode) {
        Map<String, Object> params = new HashMap<>();
        params.put("merchantCode", merchantCode);
        return getSqlSession().selectList(this.getStatement("getAccountsMerchantCode"), params);
    }

    @Override
    public List<CeAgentAccountEntity> queryAccountAll(Page page) {
        Map<String, Object> params = new HashMap<>();
        params.put("page",page);
        return getSqlSession().selectList(this.getStatement("queryAccountAll"), params);
    }

    @Override
    public List<CeAgentAccountEntity> queryAccountByMerchant(Page page, String merchantCode) {
        Map<String, Object> params = new HashMap<>();
        params.put("page",page);
        params.put("merchantCode", merchantCode);
        return getSqlSession().selectList(this.getStatement("queryAccountByMerchant"), params);
    }

    @Override
    public Integer selectAllCount() {
        return getSqlSession().selectOne(this.getStatement("selectAllCount"));
    }

    @Override
    public List<Integer> getRepeatWhiteList() {
        Map<String, Object> params = new HashMap<>();
        return getSqlSession().selectList(this.getStatement("getRepeatWhiteList"), params);
    }

    @Override
    public List<WhiteListBean> getWhiteList(String merchantCode, String overdueDays) {
        Map<String, Object> params = new HashMap<>();
        params.put("merchantCode",merchantCode);
        params.put("overdueDays",overdueDays);
        return getSqlSession().selectList(this.getStatement("getWhiteList"), params);
    }

    @Override
    public Integer selectCountByMerchant(String merchantCode) {
        Map<String, Object> params = new HashMap<>();
        params.put("merchantCode",merchantCode);
        return getSqlSession().selectOne(this.getStatement("selectCountByMerchant"), params);
    }
}